#ifndef APPGLOBAL_H
#define APPGLOBAL_H

#include <QObject>


class YDUrlRecogniser;
class QNetworkAccessManager;
//class QWebView;
class YDDiskMap;
class YDAppSettings;
class YDDownloadThread;

class YDAppGlobal : public QObject {
    Q_OBJECT
public:
    explicit YDAppGlobal() : QObject(nullptr) {}
    ~YDAppGlobal() {}

    bool initialize();
    void uninitialize();

    YDAppSettings* settings = nullptr;
    YDUrlRecogniser* urlRecogniser = nullptr;
    // 主线程使用的网络管理对象
    QNetworkAccessManager* networkAccessMgr = nullptr;
    // 用来应付需要运行 js 才能得到内容的情况
    //QWebView* webView = nullptr;
    // 网盘类型和资料的映射表
    YDDiskMap* diskMap = nullptr;
    YDDownloadThread* downloadThread = nullptr;

    // 文件名处理
    static void SplitPath(const QString& fullPath, QString& drive, QString& dir, QString& fileName, QString& ext);
    static QString MakePath(const QString& drive, const QString& dir, const QString& fileName, const QString& ext);
    static QString unescape(const QString& src);

    static QString version() {
        return "0.1.0";
    }
};

extern YDAppGlobal g;

#endif // APPGLOBAL_H
